var t = require("../../../mybehaviors/location/location");

Component({
    behaviors: [ t ],
    properties: {
        datas: {
            type: null
        },
        component_id: {
            type: null
        },
        page_id: {
            type: null
        }
    },
    data: {
        address: "",
        point: {
            lat: "",
            lng: ""
        },
        city: ""
    },
    lifetimes: {
        attached: function() {},
        moved: function() {},
        detached: function() {}
    },
    attached: function() {},
    ready: function() {
        var t = this;
        this._getLocation(function(o, e) {
            t.setData({
                address: o.address,
                city: o.address_component.city ? o.address_component.city : o.address_component.province,
                point: e
            });
        });
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {},
        resize: function() {}
    },
    methods: {
        tolocation: function() {
            var t = getCurrentPages(), o = t[t.length - 1], e = "/".concat(o.route, "?page_id=").concat(this.data.page_id);
            wx.setStorageSync("diyurl", e), wx.navigateTo({
                url: "/packageC/o2o/o2oLocation/o2oLocation?tag=diy"
            });
        },
        tosearch: function() {
            if (this.data.city) {
                var t = this.data.datas.search_type || "store";
                wx.navigateTo({
                    url: "/packageC/o2o/o2oSearchMultiple/o2oSearchMultiple?city=" + this.data.city + "&point=" + JSON.stringify(this.data.point) + "&search_type=" + t
                });
            } else wx.showToast({
                icon: "none",
                title: "请先选择城市",
                duration: 1e3
            });
        }
    }
});